import { userGetAll } from "@/api/user"
import { literatureall, libraryall, frameall, categoryall } from "@/api"

export function useSelectAsync() {
  /**
   * 获取所有可用的用户
   */
  const useGetUserAll = () => {
    return new Promise((resolve, reject) => {
      userGetAll().then(res => {
        resolve(res.content)
      })
    })
  }
  /**
   * 获取所有的可用文献
   */
  const useGetLiteratureAll = () => {
    return new Promise((resolve, reject) => {
      literatureall().then(res => {
        resolve(res.content)
      })
    })
  }
  /**
   * 获取所有藏馆
   */
  const useGetLibraryAll = () => {
    return new Promise((resolve, reject) => {
      libraryall().then(res => {
        resolve(res.content)
      })
    })
  }
  /**
   * 获取所有层架
   */
  const useGetFrameAll = () => {
    return new Promise((resolve, reject) => {
      frameall().then(res => {
        resolve(res.content)
      })
    })
  }
  /**
     * 获取所有书籍分类
     */
  const useGetBookCategoryAll = () => {
    return new Promise((resolve, reject) => {
      categoryall().then(res => {
        resolve(res.content)
      })
    })
  }
  return {
    useGetUserAll,
    useGetLiteratureAll,
    useGetLibraryAll,
    useGetFrameAll,
    useGetBookCategoryAll
  }

}